import { defineStore } from 'pinia'
/**
 * const store = useCounterStore()
 * store.plus()
 * store.setCounter(10)
 * 获取值
 *  store.getter.count
 */
export const useCounterStore = defineStore('counter', {
    state: () => {
        return {
            counter: 0,
        }
    },
    actions: {
        plus() {
            this.counter++
        },
        setCounter(num: number) {
            this.counter = num
        },
    },
    getters: {
        count: state => state.counter,
    },
})
